/**
 * Created by zzc on 2017/11/21
 */


'use strict'

import React, {Component} from 'react';

import {
    View,
    Text,
    Image,
    StyleSheet,
    ScrollView,
    Platform,
    BackHandler
} from 'react-native';

import BaseScene from '../../../base/BaseScene'
import ConsoleLogUtil from "../../../base/util/ConsoleLogUtil";
import {BASE_FIND_HOUSE_URL, DIALOG_LOADING, PAGE_LOADING} from "../../../base/Constants";
import HouseDetailTitle from './HouseDetailTitle'
import HouseDetailBasicInfo from './HouseDetailBasicInfo'
import HouseDetailDesc from './HouseDetailDesc'
import HouseDetailConfig from './HouseDetailConfig'
import HouseDetailRooms from "./HouseDetailRooms";
import BannerComponent from "../../../base/widget/BannerComponent";
import {Actions} from "react-native-router-flux";
import FindHouseApi from "../api/FindHouseApi"

export default class FindHouseDetailScene extends BaseScene {

    _onBackAndroid = () => {
        Actions.pop();
        return true;
    };

    constructor(props){
        super(props);
        this.state = {
            response:"",
        }
    }

    componentDidMount(){
        this._getHouseDetail();
    }

    _getHouseDetail=()=>{
        let params = {"id":this.props.houseID,"ambitusRoomsCount":6,"dataFrom":"APP"}
        this._fetchRequest(this.props.isShare=="SHARE"?FindHouseApi.getHouseDetailShare:FindHouseApi.getHouseDetailEntire,params);
    }

    _requestSuccess=(response)=>{
        this.setState({
            response:response.obj
        })
    }

    _onReloadClick=()=>{
        this._getHouseDetail()
    }

    render(){
        return(
            <ScrollView style={{backgroundColor:'#F7F8FA'}}>
                <BannerComponent/>
                <HouseDetailTitle item = {this.state.response}/>
                <HouseDetailBasicInfo item = {this.state.response} />
                <HouseDetailDesc item = {this.state.response} />
                <HouseDetailConfig item = {this.state.response}/>
                <HouseDetailRooms item = {this.state.response}/>
            </ScrollView>
        );
    }
}

const styles = StyleSheet.create({
    icon: {
        width: 110,
        height: 80,
    },
    rightContainer: {
        flex: 1,
        paddingLeft: 10,
        paddingRight: 10,
    },
    title: {
        fontSize: 15,
        color: 'black',
    },
    desc: {
        fontSize:12,
        color:'#8F8E94',
        marginTop:5
    },
    price: {
        fontSize:15,
        color:'#FF3366',
        marginTop:5
    },
    h3s: {
        fontSize:10,
        color:'#FF3366',
    },
    tagOne: {
        fontSize: 10,
        color: '#33CFD9',
        borderWidth:1,
        borderColor:'#33CFD9',
        borderRadius:2,
        paddingLeft:2,
        paddingRight:2,
        textAlign:'center'
    },
    tagTwo: {
        fontSize: 10,
        marginLeft:3,
        color: '#FDB73C',
        borderRadius:2,
        borderWidth:1,
        borderColor:'#FDB73C',
        paddingLeft:2,
        paddingRight:2,
        textAlign:'center'
    },
    image: {
        height: 200,
    },
})